scVelo builds a “velocity graph” based on a similarity matrix. Entries in the similarity matrix are the cosine similarity between the velocity vector and the cell difference vector. Additionally, scVelo computes a transition matrix, in which entries represent the probabilities of cell–>cell transitions. These probabilities are calculated based on the similarities from above. Here, we want to build a graph using these two matrices as adjacency matrices and compare the resulting force-directed embeddings to the embedding that we build using the composite distance function.

Setup and get data from scVelo

Use the reticulate package to use scVelo from within R:

Make fdg embedding

Extract count data..

Filter genes

Downsample cells to make things easier

Normalize for dimensional reduction

## Warning in if (!class(counts) %in% c("dgCMatrix", "dgTMatrix")) {: the condition
## has length > 1 and only the first element will be used
## Converting to sparse matrix ...
## Normalizing matrix with 1232 cells and 8724 genes

Dimensional reduction

Run velocyto on panc data

Scores of observed and projected states in PC space

Graph visualization on subset of cells from PC coordinates

Calculate velocity on subsampled data

1232 cells

Run scvelo velocity on same subset used to make fdg graph

Make graph

Compare consistency scores

Threshold similarities

first, look at distribution of all similarities to help pick threshold..

..looks like there are at least a couple of “populations” here..

Let’s try a few thresholds up to 0.3..

As we increase the threshold, the number of unconnected cells increases as expected. But this seems to be primarily affecting ductal cells (red/orange cluster).
..looks like similarities between ductal cells are generally lower than in other cell types – are they cycling? We might not have enough cells to capture cycling behavior..
In weighted graph, ductal cells appear more spread out than other cell types. This makes sense given their lower similarities.